CFLAG := -Wall -Wno-unused-but-set-variable -Wno-unused-result -std=gnu11 -lpthread
DFLAG := #-g -DDEBUG
LDFLAGS :=
CC := gcc
TOP = $(shell pwd)

TARGET := $(TOP)/linx-random

LINX_SRC := $(wildcard $(TOP)/*.c $(TOP)/../sm3/*.c $(TOP)/../mpi/*.c)
LINX_OBJ := $(patsubst %.c,%.o,$(LINX_SRC))
LINX_INC := -I$(TOP) -I$(TOP)/../sm3 -I$(TOP)/../mpi

all: $(TARGET)

$(TARGET):$(LINX_OBJ)
	@$(CC) $(CFLAG) $(DFLAG) $(LINX_INC) -o $@ $^ $(LDFLAGS)

%.o : %.c
	$(CC) $(CFLAG) -c $< $(DFLAG) $(LINX_INC) -o $@

clean:
	@rm -rf $(TARGET) $(LINX_OBJ)
